<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page"/>

<fmt:setBundle basename="ApplicationMessage"/>
<fmt:setLocale value="zh_CN"/>

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp" %>
  <%@ include file="/WEB-INF/include/css.jsp" %>

</head>

<body class="ms-theme-blue">

	<%@ include file="/WEB-INF/include/header.jsp" %>
	<%@ include file="/WEB-INF/include/submenu.jsp" %>

  <div class="container-fluid ms-container has-ms-sidemenu">

    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">绩效考核管理</li>
    </ol>
  
    <div class="ms-content-layout">
  
      <div class="ms-operation-bar no-margin no-bottom-border clearfix">
        <div class="ms-operation-group pull-right">
  
          <a href="${ctx.host}/appraisals/search" data-target="#search" data-toggle="modal"
            class="btn ms-btn ms-btn-blue">
             <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
          </a>
          
          <a href="${ctx.host}/appraisals/create" data-target="#create" data-toggle="modal"
           class="btn ms-btn ms-btn-blue">
            <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;创建考核
          </a>
  
        </div>
      </div>
  
      <table class="table table-hover ms-table">
        <thead>
          <tr>
            <th>序号</th>
            <th>考核名称</th>
            <th>考核类型</th>
            <th>考核时间</th>
            <th>发起人</th>
            <th class="text-center">是否完成</th>
            <th>总分</th>
            <th class="text-center">操作</th>
          </tr>
        </thead>
  
        <tbody>
          <c:forEach items="${appraisals}" var="appraisal" varStatus="ordinal">
    	      <tr>
    	        <td>${ordinal.count}</td>
    	        <td>${appraisal.name}</td>
    	        <td>${appraisal.target.description}</td>
    	        <td><fmt:formatDate value="${appraisal.beginDate}" pattern="yyyy/MM/dd"/>&nbsp; - &nbsp;<fmt:formatDate value="${appraisal.endDate}" pattern="yyyy/MM/dd"/></td>
    	        <td>${persist.user(appraisal.creator).loginName}</td>
    	        <td class="text-center">${appraisal.finished? '是' : '否'}</td>
    	        <td><fmt:formatNumber value="${appraisal.scoreTotal}" pattern="0.00" /></td>
    	        <td class="text-center">
    	          <a href="${ctx.host}/appraisals/${appraisal.id}" >详情</a>&nbsp;&nbsp;
      	        <c:if test="${not appraisal.finished}">
      	          <a href="${ctx.host}/appraisals/${appraisal.id}/sign" data-target="#sign" data-toggle="modal">标记完成</a>&nbsp;&nbsp;
                  <a href="${ctx.host}/appraisals/${appraisal.id}/delete" data-target="#delete" data-toggle="modal">删除</a>&nbsp;&nbsp;
      	        </c:if>
    	        </td>
    	      </tr>
          </c:forEach>
        </tbody>
  
        <tfoot>
          <tr>
            <td colspan="8" class="no-vertical-padding">
              <div class="pull-left">
                <jsp:include page="/WEB-INF/include/page.jsp">
                  <jsp:param name="url" value="appraisals"/>
                  <jsp:param name="queryString" value="${queryString}"/>
                </jsp:include>
              </div>
            </td>
          </tr>
        </tfoot>
      </table>
  
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp" %>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/supplier/performance/appraisal/appraisal-list.js"/>
  <script type="text/javascript">
    require(['page/supplier/performance/appraisal/appraisal-list'], function (page) {
      page.init()
    })
  </script>
  
</body>
</html>
